import request from '@/utils/request'
import store from "@/store";
// 查询合同业务分类列表
export function listContractBusinessType(query) {
  return request({
    url: '/console/contractBusinessType/list',
    method: 'get',
    params: query
  })
}

// 查询合同业务分类列表
export function listDTOContractBusinessType(query) {
  return request({
    url: '/console/contractBusinessType/listDTO',
    method: 'get',
    params: query
  })
}

// 根据合同类型id 查询业务分类
// export function listBycontractTypeId(query) {
//   if (store.getters.isCompany){
//     return request({
//       url: '/console/contractBusinessType/listBycontractTypeId',
//       method: 'get',
//       params: {contractTypeId: query}
//     })
//   } else {
//     return request({
//       url: '/person/contractBusinessType/listBycontractTypeId',
//       method: 'get',
//       params: {contractTypeId: query}
//     })
//   }
// }

// 根据合同类型id 查询业务分类
export function listBycontractTypeId(query) {
  if (store.getters.staffInfo.companyId != 0){
    return request({
      url: '/console/contractBusinessType/listBycontractTypeId',
      method: 'get',
      params: {contractTypeId: query}
    })
  } else {
    return request({
      url: '/person/contractBusinessType/listBycontractTypeId',
      method: 'get',
      params: {contractTypeId: query}
    })
  }
}


// 根据合同类型id 查询业务分类 带权限的业务分类查询
export function listByPermissionsContractTypeId(query) {
  if (store.getters.isCompany){
    return request({
      url: '/console/contractBusinessType/listByPermissionsContractTypeId',
      method: 'get',
      params: {contractTypeId: query}
    })
  } else {
    return request({
      url: '/person/contractBusinessType/listBycontractTypeId',
      method: 'get',
      params: {contractTypeId: query}
    })
  }
}

// 查询合同业务分类详细
export function getContractBusinessType(id) {
  return request({
    url: '/console/contractBusinessType/' + id,
    method: 'get'
  })
}

// 新增合同业务分类
export function addContractBusinessType(data) {
  return request({
    url: '/console/contractBusinessType',
    method: 'post',
    data: data
  })
}

// 修改合同业务分类
export function updateContractBusinessType(data) {
  return request({
    url: '/console/contractBusinessType',
    method: 'put',
    data: data
  })
}

// 删除合同业务分类
export function delContractBusinessType(id) {
  return request({
    url: '/console/contractBusinessType/' + id,
    method: 'delete'
  })
}

// 根据选择的业务分类查询 业务分类下的流程绑定人员权限
export function selectIsHaveBusinessTypePermissions(businessTypeInfo) {
  return request({
    url: '/console/contractBusinessType/selectIsHaveBusinessTypePermissions',
    method: 'get',
    params: businessTypeInfo
  })
}
